import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect:'/home',
    children:[
      {
        path:'/home',
        component:()=>import(/* webpackChunkName: "home" */ '../views/home/home')
      },
      {
        path:'/classfy',
        component:()=>import(/* webpackChunkName: "classfy" */ '../views/classfy/classfy')
      },
      {
        path:'/jx',
        component:()=>import(/* webpackChunkName: "jx" */ '../views/jx/jx')
      }
      
    ]
  },
  {
    path:'/cart',
    component:()=>import(/* webpackChunkName: "cart" */ '../views/cart/cart')
  },
  {
    path:'/user',
    component:()=>import(/* webpackChunkName: "user" */ '../views/user/user')
  },
  {
    path:'/goodsinfo/:id',
    name:'goodsinfo',
    component:()=>import(/* webpackChunkName: "goodsinfo" */ '../views/goodsinfo/goodsinfo')
  },
  {
    path:'/login',
    component:()=>import(/* webpackChunkName: "login" */ '../views/login/login')
  },
  {
    path:'/reg',
    component:()=>import(/* webpackChunkName: "reg" */ '../views/login/reg')
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
